package com.itheima.myConcurrentHashMap;

import java.util.concurrent.ConcurrentHashMap;

public class Demo {
    public static void main(String[] args) throws InterruptedException {
        ConcurrentHashMap<String, String> ht = new ConcurrentHashMap<>();
        new Thread(() -> {
            for (int i = 0; i < 20; i++) {
                ht.put(i + " ", i + " ");
            }
        }).start();

        new Thread(() -> {
            for (int i = 20; i < 41; i++) {
                ht.put(i + " ", i + " ");
            }
        }).start();

        System.out.println("==========================");
        Thread.sleep(1000);

        for (int i = 0; i < 41; i++) {
            System.out.println(ht.get(i + " "));
        }
    }
}
